<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<head th:include="common/header"></head>
<body>
	<div class="layui-fluid">

		<!-- 导航菜单 -->
		<div th:replace="common/system/system_fragment :: system_menu('系统管理')"></div>

		<!-- 当前位置 -->
		<div th:replace="common/system/system_fragment :: system_locations('系统管理', '权限管理', '编辑信息')"></div>
		
		<div class="layui-row  yy-margin-top-10">
		
			<fieldset>
				<legend><a>基本信息</a></legend>
			
				<form class="layui-form" method="post">
				<!-- 查询 -->
					<div class="layui-colla-item">
						<div class="layui-form layui-form-pane">
							<!-- 权限id -->
							<input type="hidden" name="id" th:value="${permission.id}">
							
							<!-- 权限名称 -->
							<div class="layui-form-item">
								<label class="layui-form-label layui-bg-orange">名称</label>
								<div class="layui-input-block">
									<input th:value="${permission.name}" type="text" name="name" autocomplete="off" class="layui-input" lay-verify="required|length50" placeholder="请输入权限名称">
								</div>
							</div>
							
							<!-- 父id -->
							<input type="hidden" name="parentid" th:value="${permission.parentid}">
							
							<!-- 顺序 -->
							<div class="layui-form-item">
								<label class="layui-form-label layui-bg-orange">顺序</label>
								<div class="layui-input-block">
									<input th:value="${permission.seq}" type="text" name="seq" autocomplete="off" class="layui-input" lay-verify="required|number" placeholder="请输入顺序" maxlength="2">
								</div>
							</div>
							
							<!-- 层级 -->
							<div class="layui-form-item">
								<label class="layui-form-label layui-bg-orange">层级</label>
								<div class="layui-input-block">
									<input class="layui-input" name="level" lay-verify="required|number" th:value="${permission.level}" maxlength="2" placeholder="请输入层级">
								</div>
							</div>
							
							<!-- url -->
							<div class="layui-form-item">
								<label class="layui-form-label layui-bg-orange">url</label>
								<div class="layui-input-block">
									<input class="layui-input" name="url" lay-verify="length100" th:value="${permission.url}" placeholder="请输入权限url">
								</div>
							</div>
							
							<!-- 认证码 -->
							<div class="layui-form-item">
								<label class="layui-form-label layui-bg-orange">认证码</label>
								<div class="layui-input-block">
									<input class="layui-input" name="authentication" lay-verify="length100" th:value="${permission.authentication}" placeholder="请输入认证码">
								</div>
							</div>
							
							<!-- 备注 -->
							<div class="layui-form-item">
								<label class="layui-form-label layui-bg-orange">备注</label>
								<div class="layui-input-block">
									<input class="layui-input" name="remark" lay-verify="length100" th:value="${permission.remark}" placeholder="请输入备注">
								</div>
							</div>
							
							<!-- 提交及取消按钮 -->
							<div class="layui-form-item">
								<div class="layui-input-block">
									<a class="layui-btn yy-float-right" href="javascript:history.go(-1);">返回</a>
									<button class="layui-btn yy-float-right yy-margin-right-10" lay-submit="" lay-filter="permission">确定</button>
								</div>
							</div>
						</div>
					</div>
				</form>
			</fieldset>
		
		</div>
		
	</div>

	<!-- 引入js -->
	<div th:replace="common/script"></div>
	
	<script type="text/javascript">
	/*<![CDATA[*/
	
	;!function(){
		
		var form = layui.form;
		
		//表单提交事件
		form.on('submit(permission)', function(data){
			$.http.submitForm({
				url:"/permission/savepermission",
				data:data.field,
				success:function(r){
					if(r && r.success){
						$.prompt.alert(r.msg, "/permission/permissionList");
					}
				}
			});
			
			return false; //阻止表单跳转。因为使用ajax所以这里阻止表单的自动跳转
		});
		
	}();
	
	/*]]>*/
	</script>
</body>

</html>